using UnityEngine;
using PnFramework.Unity;
using PnFramework;
using BilibiliUtilities.Live.Message;

namespace UnitySmallTheater
{
    public class GameLoop : MonoBehaviour
    {
        private PlayerMgr playerMgr;
        private InputMgr inputMgr;
        private DanmuInstruction mInstruction;

        private void Awake()
        {
            inputMgr = new InputMgr();
            playerMgr = new PlayerMgr();
            mInstruction = new DanmuInstruction();

            LiveMsgMgr.Instance.ConnectLive(51238);
            EventMgr.Instance.Register<DanmuMessage>(LiveMsg.DanMu, mInstruction.OnTrigger);
            EventMgr.Instance.Register<DanmuInstruction.Info>(DanmuInstruction.Ctrl, playerMgr.OnReceiveInstruction);
        }
        private void Update()
        {
            inputMgr.Update();
        }
    }
}